{% extends "index.html" %}

{% from "util.html" import dropdown %}

{% block main %}
{{ dropdown('classes-list', '班级列表', [], 'menu-classes') }}
<br>
<script>
    $(document).ready(function() {
        $.get("/ajax/class", function(data) {
            data.forEach(function(cls) {
                $("#menu-classes").append(`<a href="/class/${cls.id}" class="dropdown-item">${cls.name}</a>`);
            })
        });
    });
</script>
<h2 class="pos-top">班级名: {{ name }}</h2>
{% for name, items in (('教师: ', teachers), ('学生: ', students)) %}
<h4 class="pos-top">{{ name }}</h4>
{% if not items %}
<p class="pos-top">暂无数据</p>
{% else %}
<ul class="menu-item list-inline tooltrip-div pos-top mb-4">
    <li class="list-inline-item d-block p-0 list-view">
        <div class="list-view-wrap" style="max-height: 300px;overflow: overlay;">
            {% for item in items %}
            <h6 class="pt-2 pb-2 {{'bg-primary text-white' if item['id'] == userid else ''}}"><a style="color: #000000" href="/user/{{item['id']}}">{{ item['name'] }}</a></h6>
            {% endfor %}
        </div>
    </li>
</ul>
{% endif %}
{% endfor %}
{% endblock %}